import request from '@/utils/request.js';

// 查询维修单列表
export function listWorkOrder(query) {
	return request({
		url: '/system/order/list',
		method: 'get',
		params: query
	});
}

// 获取维修单详情
export function getWorkOrder(workNo) {
	return request({
		url: `/system/order/${workNo}`,
		method: 'get'
	});
}

// 新增维修单
export function addWorkOrder(data) {
	return request({
		url: '/system/order',
		method: 'post',
		data: data
	});
}

// 修改维修单（用于指派维修人员）
export function updateWorkOrder(data) {
	return request({
		url: '/system/order',
		method: 'put',
		data: data
	});
}

// 删除维修单
export function delWorkOrder(workNo) {
	return request({
		url: `/system/order/${workNo}`,
		method: 'delete'
	});
}

// 获取维修单状态履历
export function getWorkOrderHistory(workNo) {
	return request({
		url: `/system/order/${workNo}/history`,
		method: 'get'
	});
}

